import 'package:aichat_flutter_wallet/module_common/widgets/image/public_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ValidateTip extends StatelessWidget {
  String? text = '';
  Function? onClose;
  EdgeInsetsGeometry? margin;

  ValidateTip({
    super.key,
    this.text = '',
    this.margin = const EdgeInsets.symmetric(horizontal: 20),
    Function? this.onClose,
  });

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      margin: margin,
      decoration: BoxDecoration(color: Color.fromRGBO(255, 248, 241, 1), borderRadius: BorderRadius.circular(10.w)),
      padding: EdgeInsets.only(left: 15.w, right: 10.w, top: 10.w, bottom: 10.w),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          PublicImage(
            image: 'assets/images/status/warn.png',
            width: 20.w,
            height: 20.w,
          ),
          SizedBox(
            width: 10.w,
          ),
          Expanded(
              child: Text(
            text!,
            style: TextStyle(
              color: Color.fromRGBO(255, 81, 0, 1),
              fontSize: 12.sp,
              height: (18/12).w,
              fontWeight: FontWeight.w400,
            ),
          )),
          SizedBox(width: 12.w,),
          Visibility(
              visible: onClose != null,
              child: GestureDetector(
                onTap: () {
                  onClose!();
                },
                child: Padding(
                  padding: EdgeInsets.symmetric(vertical: 2,horizontal: 2),
                  child: PublicImage(
                    image: 'assets/images/status/warn_close.png',
                    width: 16.w,
                    height: 16.w,
                  ),
                ),
              ))
        ],
      ),
    );
  }
}
